<template>
  <div>
    <el-link type="primary" @click.native="viewContentHtml"
      >点击查看标签</el-link
    >
    <el-dialog
      title="标签信息"
      :visible.sync="dialogView"
      style="height: 950px; overflow: auto"
    >
      <el-table :data="urlList" size="mini">
        <el-table-column property="orderNo" label="订单号"> </el-table-column>
        <el-table-column property="subNo" label="箱号"> </el-table-column>
        <el-table-column property="trackNo" label="追踪号"> </el-table-column>
        <el-table-column property="status" label="标签状态"> </el-table-column>
        <el-table-column label="PDF" show-overflow-tooltip>
          <template slot-scope="scope">
            <template v-if="scope.row.labelUrl">
              <el-link
                :href="fileUrl + scope.row.labelUrl"
                target="_blank"
              >
                标签
              </el-link>
            </template>
          </template>
        </el-table-column>
        <el-table-column property="cdate" label="创建时间"> </el-table-column>
      </el-table>
    </el-dialog>
  </div>
</template>
<script>
import { ajax } from "@/store/yg/common/utils";
import * as constant from "@/store/yg/common/constant";
console.log('constant :>> ', constant);
export default {
  props: ["data"],
  data() {
    return {
      fileUrl: constant.FILE_SERVER,
      urlList: [],
      urlStatus: {},
      trackList: false,
      dialogView: false
    };
  },
  mounted() {},
  methods: {
    viewContentHtml: function() {
      debugger;
      console.log(this.data);
      if (this.data["id"]) {
        var id = this.data["id"];
        ajax("viewTrackPrintlabelUrls", { id: id }).then(
          res => {
            console.log(res);
            if (res.code == 200) {
              this.urlList = res.data;
              this.urlStatus = res.data2;
              for (var url in this.urlList) {
                console.log(this.urlList[url]);
                this.urlList[url]['status'] = this.urlStatus[this.urlList[url]['status']];
                console.log(this.urlList[url]);
              }
              this.dialogView = true;
            }
          },
          error => {
            console.log(error);
          }
        );
      }
    }
  }
};
</script>
